<?php
declare(strict_types=1);
/**
 * Created by PhpStorm
 * User: Administrator
 * Date: 2023/7/14
 * Time: 14:29:51
 */

namespace Service\ActivityService;

use Hyperf\DbConnection\Db;

/**
 * 店铺特价活动服务
 */
class MnActivityService extends \Service\BaseService
{
    /**
     * 获取活动特价数据
     * @param array $actIds
     */
    public function getActivityGoodsList($mn_sid)
    {
        return Db::table('ly_mn_activity')
            ->join('ly_mn_activity_goods','ly_mn_activity_goods.mn_activity_id','=','ly_mn_activity.id')
            ->where('ly_mn_activity_goods.df',0)
            ->where('ly_mn_activity.mn_sid',$mn_sid)
            ->where('ly_mn_activity.status',1)
            ->where('ly_mn_activity.startdate','<',time())
            ->where('ly_mn_activity.enddate','>',time())
            ->select([
                'ly_mn_activity.id as mn_activity_id',
                'ly_mn_activity.type',
                'ly_mn_activity.name',
                'ly_mn_activity.full',
                'ly_mn_activity.drop',
                'ly_mn_activity_goods.goods_id',
                'ly_mn_activity_goods.price'
            ])
            ->get()->toArray();
    }
}